OpenBuildings GenerativeComponents Help

Creating Nodes from Constituent Nodes Script Transactions

Constituent nodes can be used as constructions when creating nodes. The benefit of using these is that they are lighter weight. Constituent nodes are not top-level nodes. They can however be accessed by indexing into the Constituents of the top-level node. Constituent elements are passed the top-level node into their constructor.

transaction 1 modelChange 'Add baseCS, Change baseCS'
{
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        GraphLocation             = <auto> {40.0, 40.0};
    }
    node User.Objects.baseCS Bentley.GC.NodeTypes.CoordinateSystem
    {
        Technique                 = 'AtModelOrigin';
        DGNModelName              = '3D Metric Design';
        GraphLocation             = {29.167, 81.667, 174.0, 0.0};
    }
}

transaction 2 script 'Create Line from constituent nodes'
{
    		Line ln = new Line("joiningLine");
    		Point startPoint = new Point(ln);
    		startPoint.ByCartesianCoordinates(baseCS, 1.2, 3.4, 0.0);
    		Point endPoint = new Point(ln);
    		endPoint.ByCartesianCoordinates(baseCS, 2.0, 4.5, 0.0);
    	    ln.ByPoints(startPoint, endPoint);
}

Here OpenBuildingsā„¢ GenerativeComponents automatically generates the name Constituents[0] for the StartPoint and Constituent[1] for the EndPoint.